package bs

import net.liftweb.http.Templates
import scala.collection.mutable
import scala.xml.NodeSeq
import net.liftweb._
import http._
import util._
import Helpers._


case class ProgressBar(percent: Int) extends LiftComponent {
  override val template = Templates("templates-hidden" :: "bs" :: "_progressbar" :: Nil).get

  override def transformer = {
    val styleAttr = s"width: $percent%"
    ".progress [class+]" #> styles.mkString(" ") &
      ".bar [style]" #> styleAttr
  }

  val styles = mutable.Buffer.empty[String]

  def info = {
    styles += "progress-info"
    this
  }
  def success = {
    styles += "progress-success"
    this
  }
  def warning = {
    styles += "progress-warning"
    this
  }
  def danger = {
    styles += "progress-danger"
    this
  }
  def striped = {
    styles += "progress-striped"
    this
  }

  def active = {
    styles += "active"
    this
  }


}
